home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Macintosh Demo Applications CD
/
Apple-MacintoshDemoApplicationsCD-1.0-1992.iso
/
More Information
/
QuicKeys
/
For Programmers Only.sea
/
C Examples
/
SampleUI.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-06-22
|
3KB
|
93 lines
/*
$Workfile: SampleUI.c $
$Revision: 1.0 $
QuicKeys sample extension user interface routine
Extension beeps after the user supplied wait time.
© 1990 CE Software, Inc. All rights reserved.
For QuicKeys 2 Extension Sample source code you have a royalty-free right
to include object code derived from this Sample source code in programs
that you develop. You also have the right to use, distribute, and license
such programs to third parties without payment of any further license fees
to CE Software, Inc., so long as a copyright notice sufficient to protect
your copyright for your software in the United States or any other country;
is included in the graphic display of your software and on the labels
affixed to the media on which your software is distributed.
WHEN WHO WHAT
•••••
9/5 mkg created version for both MPW and Think C
6/17 mkg add balloon help example
•••••
*/
#ifdef THINK_C
#include "packagemgr.h"
#else
#include "types.h"
#include "dialogs.h"
#include "packages.h"
#include "resources.h"
#include "memory.h"
#endif
#include "extensions.h"
#include "SampleData.h"
/* items in our DITL list */
#define ditlWaitTime 1
long pascal
main(short wSelector, DialogPtr pDialog, short wHitItem, short wFirstItem,
SampleData* pMyData, long lRefCon) {
Str255 strWaitTime;
short wType;
Handle hItem;
Rect rDitl;
Handle hHelp;
switch(wSelector) {
case newUI:
/* the user has just created a new key. initialize it */
pMyData->lWaitTime = 0;
pMyData->hdr.wLength = sizeof(SampleData);
break;
case initUI:
/* QuicKeys 2™ is about to display our dialog. set up our dialog items */
NumToString(pMyData->lWaitTime, strWaitTime);
GetDItem(pDialog, ditlWaitTime + wFirstItem, &wType, &hItem, &rDitl);
SetIText(hItem, strWaitTime);
/* fudge the hdlg resource to set the number of dialog items to skip */
hHelp = GetResource('hdlg', -14348);
if (hHelp != nil)
BlockMove((Ptr)&wFirstItem, *hHelp + 2, sizeof(short));
break;
case hitUI:
/* the user clicked or typed into one of our items */
/* in this example, there is nothing to do */
break;
case doneUI:
/*
* The user has clicked ok or cancel.
* Collect items from dialog and place in key data.
*
* Important note: Since QuicKeys gives us a copy of the key data to
* work on, we don't care whether user hit ok or cancel. QuicKeys will
* discard the copy if the user hit cancel or update the actual key data
* if the user hit ok.
*/
GetDItem(pDialog, ditlWaitTime + wFirstItem, &wType, &hItem, &rDitl);
GetIText(hItem, strWaitTime);
StringToNum(strWaitTime, &(pMyData->lWaitTime));
break;
}
return 0;
}